package com.tidc.checkprovider.mapper;




import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tidc.checkprovider.pojo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

/**
 * @ClassNmae MatchsMapper
 * @Description TODO
 * @Author 14631
 **/

@Repository
public interface MatchsMapper extends BaseMapper<Matchs> {
	@Select("select DISTINCT(m.id) from power p INNER JOIN matchs m where p.power_teacher_id=#{value} and m.flag= 0 or m.teacher_id=#{value} and m.flag= 0")
	public Set<Integer> selectTeacherMatchs(int value);
	public int insertMatchs(Matchs matchs);
	@Select("select * from matchs where id=#{value}")
	public Matchs selectMatchs(int value);
	@Select("select * from matchs where teacher_id=#{value}")
	public List<Matchs> selectMyMatchs(int value);
	public void addPower(Power power);
	@Select("select * from works where works_matchs_id=#{value}")
	public List<Works> selectMatchsWorks(int value);
	@Select("select team.id,name,team_student_id,team_works_id,member_student_id from team,member where team.team_works_id=#{member.member_team_id}")
	public Team selectTeam_member(int value);
	public Works selectWorks(int value);
	public void numberUP(int id);
	public void updateMatch(Matchs matchs);
	@Select("select * from matchs where flag=1")
	public List<Matchs> checkMatch();
	public void setFlag(int id);
	@Select("select * from matchs where flag=1 and school=#{value}")
	public List<Matchs> checkMyMatch(String value);
//	@Select("select *  from matchs where flag = 1 order by id desc limit 8")
	@Select("select *  from matchs where flag = 1 order by id desc limit 8")
	public List<Matchs> getIndexRank();
	@Select("select * from matchs where flag = 1 and domain = #{value}")
	public List<Matchs> getDomainMatch(String value);
	@Select("select * from matchs where flag = 1 and name like '%${value}%'")
	public List<Matchs> likeMatch(String value);
	public List<Matchs> checkStudentMatch(List<Integer> list);
	@Select(" select * from matchs where flag=0 and domain=#{value}")
	public List<Matchs> getDomainTopMatch(String domain);
	@Select("select t.userName,t.school,t.id from teacher t INNER JOIN power p where p.power_matchs_id=#{value} and p.power_teacher_id = t.id;")
	public List<Teacher> checkMatchPower(int value);
	public void deletePower(int value);
}
